home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1998 August / PC Plus SuperCD 50a Issue 142 (CD142a) (August 1998).iso / trial / demon / TURNPIKE.1 / CLASSES.ZIP / sun / tools / ZIP / ZipReaderInputStream.class (.txt) < prev   
Encoding:
Java Class File  |  1997-04-14  |  987 b   |  59 lines

  1. package sun.tools.zip;
  2.  
  3. import java.io.IOException;
  4. import java.io.InputStream;
  5.  
  6. class ZipReaderInputStream extends InputStream implements ZipConstants {
  7.    // $FF: renamed from: is java.io.InputStream
  8.    private InputStream field_0;
  9.    int count;
  10.  
  11.    ZipReaderInputStream(InputStream var1, ZipEntry var2) {
  12.       this.field_0 = var1;
  13.       this.count = (int)var2.length;
  14.    }
  15.  
  16.    public int read(byte[] var1, int var2, int var3) throws IOException {
  17.       if (this.count <= 0) {
  18.          return -1;
  19.       } else {
  20.          int var4 = this.field_0.read(var1, var2, var3 > this.count ? this.count : var3);
  21.          if (var4 == -1) {
  22.             throw new IOException("Unexpected EOF");
  23.          } else {
  24.             this.count -= var4;
  25.             return var4;
  26.          }
  27.       }
  28.    }
  29.  
  30.    public int read() throws IOException {
  31.       if (this.count <= 0) {
  32.          return -1;
  33.       } else {
  34.          int var1 = this.field_0.read();
  35.          if (var1 == -1) {
  36.             throw new IOException("Unexpected EOF");
  37.          } else {
  38.             --this.count;
  39.             return var1;
  40.          }
  41.       }
  42.    }
  43.  
  44.    public long skip(long var1) throws IOException {
  45.       if (this.count <= 0) {
  46.          return 0L;
  47.       } else {
  48.          var1 = this.field_0.skip(var1 > (long)this.count ? (long)this.count : var1);
  49.          this.count = (int)((long)this.count - var1);
  50.          return var1;
  51.       }
  52.    }
  53.  
  54.    public int available() throws IOException {
  55.       int var1 = this.field_0.available();
  56.       return var1 > this.count ? this.count : var1;
  57.    }
  58. }
  59.